package com.cnb.demo.controller;

import com.cnb.demo.service.TestService;
import com.cnb.servlet.v1.annotation.Autowrite;
import com.cnb.servlet.v1.annotation.Controller;
import com.cnb.servlet.v1.annotation.RequestMapping;
import com.cnb.servlet.v1.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller(alias = "testController")
@RequestMapping(value = "/api")
public class TestController {

    @Autowrite
    TestService testService;

    @RequestMapping(value = "/test")
    public void test(HttpServletRequest req, HttpServletResponse resp,@RequestParam(value = "name") String name){
        try {
            resp.getWriter().write("Hello is " + name);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void add(){

    }
}
